filechooser: Don't crash if invalid thumbnails exist
authorBenjamin Otte <otte@redhat.com>
Fri, 6 Dec 2013 18:15:24 +0000 (19:15 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 7 Dec 2013 00:39:38 +0000 (01:39 +0100)
Failing to load a thumbnail returns a NULL pixbuf. Since the hidpi
patches this wasn't checked when creating the surface. Result: assertion
failure.

https://bugzilla.gnome.org/show_bug.cgi?id=719977

gtk/gtkfilesystem.c

index 65cca3f75a1277669012ab236390143913b5995c..b3509fefb576b3446cd781969ef56c6e35dd6f9b 100644 (file)
@@ -813,9 +813,12 @@ _gtk_file_info_render_icon (GFileInfo *info,
                                                 icon_size*scale, icon_size*scale,
                                                 NULL);
 
-      surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale,
-                                                      gtk_widget_get_window (widget));
-      g_object_unref (pixbuf);
+      if (pixbuf != NULL)
+        {
+          surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale,
+                                                          gtk_widget_get_window (widget));
+          g_object_unref (pixbuf);
+        }
     }
 
   if (!surface)